/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package generadordescktop;

import generadorabm.Clase;
import generadorabm.Controladora;
import generadorabm.OTablaExtiende;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author agustin
 */
public class ExtiendeTableModel extends AbstractTableModel implements OTablaExtiende {

    public String[][] cargarDatos() {

        try {
            List<String> clases2 = Controladora.getInstance().getCreadoraClase().getClase().getExtiende();
            clases = new String[clases2.size()][1];

            for (int x = 0; x < clases2.size(); x++) {
                clases[x][0] = clases2.get(x);
                System.out.println(clases2.get(x).toString());
            }
        } catch (Exception e) {
            throw new UnsupportedOperationException(e.toString());
        }

        return clases;
    }
    private String clases[][] = cargarDatos();

    public String[][] getClases() {
        return clases;
    }

    public void setClases(String[][] clases) {
        this.clases = clases;
    }

    public int getRowCount() {
        if (clases.length == 0) {
            return 0;
        } else {
            return clases.length;
        }

    }

    public int getColumnCount() {
        if (clases.length == 0) {
            return 0;
        } else {
            return clases[0].length;
        }
    }

    public String getValueAt(int rowIndex, int columnIndex) {
        String a = "";
        try {
            a = getClases()[rowIndex][columnIndex];
            return a;
        } catch (Exception e) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

    public void notificarExtiende() {
//      clases = cargarDatos();
        try {
            GeneradorDescktop.getInstance().actualizarExtiende();
        } catch (Exception e) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

    }
}
